#include <head.h> 
//生产者
int main(int argc, char const *argv[])
{
    int fd = open("fifo.txt", O_WRONLY);
    OPEN_ERR(fd);
    flock(fd, LOCK_EX);
    while (1)
    {
        char buf[128] = {0};
        printf("请输入要发送的数据：");
        fgets(buf, sizeof(buf), stdin);
        write(fd, buf, strlen(buf));
    }
    flock(fd, LOCK_UN);
    close(fd);
    return 0;
}
